<div class="perm-container">

<div class="perm-layout-1">
<label><input name="perms" value="/frame/resource,/resource/v_left.do,/resource/v_tree.do,/resource/v_list.do" type="checkbox"/>资源</label>
	<div class="perm-layout-2">
	<label><input value="/resource/v_add.do,/resource/o_save.do,/resource/o_create_dir.do,/resource/v_upload.do,/resource/o_upload.do,/resource/o_swfupload.do" type="checkbox" name="perms"/>添加</label>
	<label><input value="/resource/v_edit.do,/resource/o_update.do,/resource/v_rename.do,/resource/o_rename.do" type="checkbox" name="perms"/>修改</label>
	<label><input value="/resource/o_delete.do,/resource/o_delete_single.do" type="checkbox" name="perms"/>删除</label>
	</div>
</div>

<div class="perm-layout-1">
<label><input value="/frame/user" type="checkbox" name="perms"/>用户</label>
<div>
	<div class="perm-layout-2">
	<label><input value="/member/" type="checkbox" name="perms"/>会员管理</label>
	</div>
	<div class="perm-layout-2">
	<label><input value="/group/" type="checkbox" name="perms"/>会员组管理</label>
	</div>
	<div class="perm-layout-2">
	<label><input value="/admin_global/" type="checkbox" name="perms"/>管理员(全站)</label>
	</div>
	<div class="perm-layout-2">
	<label><input value="/admin_local/" type="checkbox" name="perms"/>管理员(本站)</label>
	</div>
	<div class="perm-layout-2">
	<label><input value="/role/" type="checkbox" name="perms"/>角色管理</label>
	</div>
</div>
</div>

</div>
<script type="text/javascript">
$(function() {
	$(".perm-container input[type=checkbox]").bind("click",function() {
		parentCheck(this);
		childCheck(this);
	});
});
function parentCheck(chk) {
	var obj = $(chk).parent().parent().parent();
	while(obj && obj.attr("class").indexOf("perm-container")==-1) {
		if(chk.checked) {
			$(obj.children()[0]).children().attr("checked",true);
		}
		obj = obj.parent();
	}
}
function childCheck(chk) {
	$(chk).parent().next().children().find("input[type=checkbox]").each(function(){this.checked=chk.checked});
}
</script>